//这个是history 是路由模式 url截取
export const geturl = (url: any) => {
  const urlObj = new URL(url)

  // 使用 URLSearchParams 来获取查询参数
  const params = new URLSearchParams(urlObj.search)

  // 提取每个参数
  const zlbUserId = params.get('zlbUserId')
  const userType = params.get('userType')
  const cubeUserId = params.get('cubeUserId')
  return { zlbUserId, userType, cubeUserId }
}
//hash模式是路由模式 url截取
export const ticket = (url: string) => {
  const hashIndex = url.indexOf('#')
  const hash = url.slice(hashIndex + 1) // 获取哈希部分
  const urlParams = new URLSearchParams(hash.split('?')[1]) // 获取查询字符串部分
  const zlbUserId = urlParams.get('zlbUserId')
  const userType = urlParams.get('userType')
  const cubeUserId = urlParams.get('cubeUserId')
  let flag
  if (zlbUserId && userType && cubeUserId) {
    flag = true
  } else {
    flag = false
  }
  return flag ? { zlbUserId, userType, cubeUserId } : {}
}
